<%--
  Author      : MadFrog
  Date        : 2018/10/9 15:53
  Description : 教职工签到页面
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>创建签到</title>
    <%@include file="../common/_head.jsp" %>
</head>
<body ontouchstart>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label for="title" class="weui-label">标题</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" id="title" name="title" type="text">
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label for="startDate" class="weui-label">开始时间</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" id="startDate" name="startDate" type="text">
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label for="place" class="weui-label">地点</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" id="place" name="place" type="text">
        </div>
    </div>
    <div style="text-align:center">
        <a href="javascript:;" onclick="save()" class="weui-btn weui-btn_primary weui-btn_medium">保存</a>
    </div>
<%@include file="../common/_foot.jsp" %>
<script>

    $(document).ready(function () {
        $("#startDate").datetimePicker();
    });

    function save() {
        var params = {};
        params.title = $("input[name='title']").val();
        params.startDate = $("input[name='startDate']").val();
        params.place = $("input[name='place']").val();
        $.ajax({
            type: "post",
            url : "${ctx}/teacher/signIn/add",
            data : params,
            dataType : "json",
            success: function (re) {
                if(true==re.success){
                    $.toast("操作成功", function () {
                        // window.location = "index";
                    });
                }else {
                    $.toast("后台错误，请联系管理员", "cancel");
                }
            },
            error: function (re) {
                $.toast("网络请求失败，请联系管理员", "cancel");
            }
        });
    }
</script>
</body>
</html>